define(["jquery", "easy-admin"], function ($, ea) {

    var type =$("#type").val();
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.user/index?type='+type,
        export_url: 'mall.user/export',
        modify_url: 'mall.user/modify',
    };

    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                height:'full-50',
                toolbar: ['refresh',
                    [],
                    'export'],
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: '用户编号',},
                    {field: 'openid', width: 200, title: '微信标识'},
                    {field: 'nickName', width: 180, title: '用户昵称'},
                    {field: 'avatarUrl',width: 150, title: '用户头像', templet: ea.table.image,search: false},
                    {field: 'mobile', width: 150, title: '用户手机号'},
                    {field: 'income', width: 150, title: '佣金收益',search: false},
                    {field: 'balance', width: 150, title: '可结算收入',search: false},
                    {field: 'totalpay', width: 150, title: '订单成交额',search: false},
                    {field: 'ordercount', width: 150, title: '订单成交总数',search: false},
                    {field: 'status', title: '封禁状态', width: 100, search: 'select', selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
                    {field: 'create_time',width: 160,  title: '创建时间', search: 'range'},
                ]],
            });
            ea.listen();
        },
    };
    return Controller;
});